package org.summer.netty;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;

public class WriteClient {
    public static void main(String[] args) throws IOException {
        SocketChannel sc = SocketChannel.open();
        int count = 0;
        if (sc.connect(new InetSocketAddress("127.0.0.1", 8080))) {
            while (true) {
                ByteBuffer buffer = ByteBuffer.allocate(1024 * 1024);
                int read = sc.read(buffer);
                count += read;
                System.out.println(count);
                buffer.clear();
            }

        }




    }
}
